home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / usr_-_Usr_Files / SBIN / PPPSETUP < prev    next >
Text File  |  1999-09-17  |  58KB  |  1,704 lines

  1. #!/bin/bash 
  2. ###############################################################################
  3. #
  4. #    PPPSETUP  --  Script to set up pppd
  5. #      History:
  6. #      7/21/95 RSL         Script created (v1.0)
  7. #         9/15/96 RSL         Added code to get the ISP's domainname (v1.1)
  8. #         9/19/96 RSL         Revamped interface to use the 'dialog' 
  9. #                             program. (v1.2)
  10. ###############################################################################
  11.  
  12. ###############################################################################
  13. #         2/22/98 KR          Added pap, chap, ms-chap, callback, & 
  14. #                             modem init string options. (v1.98)
  15. #                             Creates /etc/ppp/options, & pap, chap, 
  16. #                  secrets files.
  17. #                             More guidance.
  18. #                             Monitor connection with tail & syslogd.
  19. #                             Demand dialing setup with ppp-2.3.0 or later.        
  20. ###############################################################################
  21.  
  22. ###############################################################################
  23. #          4/4/98 PJV         Fixed massive /tmp-related security problems
  24. #                             Switched to a default init string that's more
  25. #                             likely to work
  26. #                             Increased TIMEOUTs
  27. #                             fixed bad flags given to chat -- caused dialout
  28. #                             to fail
  29. ###############################################################################
  30.  
  31. ###############################################################################
  32. #          2/6/1999 PJV       Changed all occurances of /dev/cua* to /dev/ttyS*
  33. ###############################################################################
  34.  
  35. ###############################################################################
  36. #          5/3/1999 PJV       Commented 'debug' in /etc/ppp/options
  37. #                             Add commented 'noauth' in /etc/ppp/options so
  38. #                             people who want to use ppp but already have a
  39. #                             default route have an easier time figuring out
  40. #                             what to do. :)
  41. ###############################################################################
  42.  
  43. TMP=/var/log/setup/tmp
  44.  
  45. if [ ! "$UID" = "0" ]; then
  46. echo
  47. echo "NOTICE: * $LOGNAME * You need to be 'root' to run this script."
  48. echo "You could login: root"
  49. echo "You could also try this: # sudo pppsetup"
  50. echo "You could also try this: # su -c pppsetup"
  51. echo "This assumes the permissions on 'sudo' and 'su' are 4111."
  52. echo "To give 'su' or 'sudo' these permissions, you have to be root."
  53. echo "~# chown root.root sudo ; chmod 4111 sudo"
  54. echo "You also need a /etc/sudoers file for 'sudo'."
  55. echo
  56. exit 1
  57. fi
  58.  
  59. if ! type -all "dialog" >/dev/null 2>&1 ; then
  60. echo
  61. echo "Can't find 'dialog', i can't run without 'dialog' on your system."
  62. echo "You can get a compiled ELF version of 'dialog' from here."
  63. echo "http://www.tux.org/pub/people/kent-robotti/index.html"
  64. echo "ftp://ftp.tux.org/pub/people/kent-robotti   'dialog-0.9a.ELF.tar.gz'"
  65. echo
  66. exit 1
  67. fi
  68.  
  69. if [ -s /usr/lib/setup/hdsetup ]; then
  70. SYS="on SLACKWARE."
  71. fi
  72.  
  73. VERSION="1.98"
  74.  
  75. stty erase ^? 2>/dev/null 
  76.  
  77. echo "PPPSETUP $VERSION $SYS" > $TMP/txtTEMP01
  78. echo >> $TMP/txtTEMP01
  79. echo "Written by Robert S. Liesenfeld <xunil@bitstream.net> <IRC:Xunil>" >> $TMP/txtTEMP01
  80. echo "Changes for 1.98 by Kent Robotti <robotti@erols.com>" >> $TMP/txtTEMP01
  81. echo "Patched for Slackware by Patrick Volkerding <volkerdi@slackware.com>" >> $TMP/txtTEMP01
  82. echo >> $TMP/txtTEMP01
  83. echo "You should get these docs if you don't already have them:" >> $TMP/txtTEMP01
  84. echo >> $TMP/txtTEMP01
  85. echo "ftp://metalab.unc.edu/pub/Linux/docs/howto/PPP-HOWTO" >> $TMP/txtTEMP01
  86. echo "ftp://metalab.unc.edu/pub/Linux/docs/faqs/PPP-FAQ" >> $TMP/txtTEMP01
  87. echo >> $TMP/txtTEMP01
  88. echo "Press [Enter] to continue with pppsetup..." >> $TMP/txtTEMP01
  89.  
  90. dialog --backtitle "PPPSETUP $VERSION/Slackware" --textbox "$TMP/txtTEMP01" 16 73 
  91.  
  92. while [ -z "$PHONENUM" ]
  93. do
  94. echo "To begin setting up your PPP connection, i need to know a few things." > $TMP/txtTEMP$$
  95. echo "For starters, what is the phone number of your (I)nternet (S)ervice" >> $TMP/txtTEMP$$ 
  96. echo "(P)rovider?" >> $TMP/txtTEMP$$ 
  97. echo  >> $TMP/txtTEMP$$ 
  98. echo "Example: atdt6661776   <-For (t)one dialing.)" >> $TMP/txtTEMP$$ 
  99. echo "Example: atdp6661776   <-For (p)ulse dialing.)" >> $TMP/txtTEMP$$ 
  100. echo  >> $TMP/txtTEMP$$ 
  101. echo "Include the: atd?  It's usally just: atdtphonenumber" >> $TMP/txtTEMP$$ 
  102. echo  >> $TMP/txtTEMP$$ 
  103. echo "(Note: in the USA, use atdt*70,6661776 [comma required!] to turn" >> $TMP/txtTEMP$$ 
  104. echo " off call waiting.)" >> $TMP/txtTEMP$$ 
  105. echo  >> $TMP/txtTEMP$$ 
  106.     
  107. dialog --title "PHONE NUMBER ..." --inputbox "`cat $TMP/txtTEMP$$`" 18 75 2> $TMP/rspTEMP$$   
  108.  
  109. if [ $? = 1 ]; then
  110. rm -f $TMP/*TEMP*
  111. clear 2>/dev/null || echo
  112. echo "PPP configuration cancelled."
  113. exit
  114. fi 
  115.  
  116. PHONENUM="`cat $TMP/rspTEMP$$`"
  117.  
  118. if [ -z "$PHONENUM" ]; then
  119. clear 2>/dev/null || echo
  120. rm -f $TMP/*TEMP*
  121. echo "PPP configuration cancelled."
  122. echo "No phone number."
  123. exit
  124. fi
  125. done
  126.  
  127. echo "Where is your modem /dev/ttyS?" > $TMP/txtTEMP$$ 
  128. dialog --backtitle "MODEM DEVICE ..." --menu "`cat $TMP/txtTEMP$$`" 11 50 4 \
  129. ttyS0 "= (COM1: under DOS)" \
  130. ttyS1 "= (COM2: under DOS)" \
  131. ttyS2 "= (COM3: under DOS)" \
  132. ttyS3 "= (COM4: under DOS)" \
  133. 2> $TMP/rspTEMP$$
  134.  
  135. MODEM="`cat $TMP/rspTEMP$$`"
  136.  
  137. if [ -z $MODEM ]; then
  138. clear 2>/dev/null || echo
  139. rm -f $TMP/*TEMP*
  140. echo "PPP configuration cancelled."
  141. exit 
  142. elif [ ! -c "/dev/$MODEM" ]; then
  143. /dev/MAKEDEV $MODEM >/dev/null 2>&1 || MODERROR="YES"
  144. else
  145. rm -f /dev/modem 2>/dev/null
  146. ln -sf /dev/$MODEM /dev/modem 2>/dev/null
  147. fi
  148.  
  149. echo "What baud rate is your modem?" > $TMP/txtTEMP$$
  150. dialog --backtitle "MODEM BAUD RATE ..." --menu "`cat $TMP/txtTEMP$$`" 14 72 7 \
  151. 460800 "460KBps  - ISDN modem..." \
  152. 230400 "230KBps  - 56Kbps modem... or ISDN modem..." \
  153. 115200 "115KBps  - 28.8, 33.6, or 56Kbps modem..." \
  154. 57600  "57.6KBps - 28.8, 33.6, or 56Kbps modem..." \
  155. 38400  "38.4KBps - Hangin ten on the net! 28.8 or 33.6..." \
  156. 19200  "19.2KBps - Better known as 14.4..." \
  157. 9600   "9600bps  - No comment..." 2> $TMP/rspTEMP$$
  158.  
  159. BAUDRATE="`cat $TMP/rspTEMP$$`"
  160.  
  161. if [ -z $BAUDRATE ]; then
  162. clear 2>/dev/null || echo
  163. rm -f $TMP/*TEMP*
  164. echo "PPP configuration cancelled."
  165. exit 
  166. fi
  167.  
  168. echo "Does your service provider use CALLBACK?" > $TMP/txtTEMP$$
  169. echo >> $TMP/txtTEMP$$
  170. echo "CALLBACK is when you call your service provider and give them" >> $TMP/txtTEMP$$
  171. echo "your phone number so they can call you back, then when they" >> $TMP/txtTEMP$$
  172. echo "call you back you give them your login name and password." >> $TMP/txtTEMP$$
  173. echo >> $TMP/txtTEMP$$
  174. echo "Most service providers don't use CALLBACK, so the answer is" >> $TMP/txtTEMP$$
  175. echo "probably No, unless you know otherwise." >> $TMP/txtTEMP$$
  176. echo >> $TMP/txtTEMP$$
  177.  
  178. dialog --backtitle "CALLBACK YES or NO? ..." --yesno "`cat $TMP/txtTEMP$$`" 13 70 
  179.  
  180. if [ $? = 0 ]; then
  181. echo "Put your phone number in the box below, so your service provider" > $TMP/txtTEMP$$
  182. echo "can call you back." >> $TMP/txtTEMP$$
  183. echo >> $TMP/txtTEMP$$
  184. echo "Example: 7771818" >> $TMP/txtTEMP$$
  185. echo >> $TMP/txtTEMP$$
  186.  
  187. dialog --backtitle "CALLBACK Your Phone Number? ..." --inputbox "`cat $TMP/txtTEMP$$`" 11 72 2> $TMP/cb1TEMP$$
  188.  
  189. if [ $? = 1 ]; then
  190. clear 2>/dev/null || echo
  191. rm -f $TMP/*TEMP*
  192. echo "PPP configuration cancelled."
  193. exit 
  194. elif [ ! -s $TMP/cb1TEMP$$ ]; then
  195. clear 2>/dev/null || echo
  196. rm -f $TMP/*TEMP*
  197. echo "PPP configuration cancelled."
  198. echo "No Phone Number for Callback."
  199. exit
  200. fi 
  201. fi
  202.  
  203. if [ -s $TMP/cb1TEMP$$ ]; then
  204. CBPN="`cat $TMP/cb1TEMP$$`"
  205. echo "I have your phone number: $CBPN" > $TMP/txtTEMP$$
  206. echo >> $TMP/txtTEMP$$
  207. echo "Do you have to give a Username or Login for the initial connection" >> $TMP/txtTEMP$$
  208. echo "to $PHONENUM before you're called back." >> $TMP/txtTEMP$$
  209. echo >> $TMP/txtTEMP$$
  210. echo "Example: jerry" >> $TMP/txtTEMP$$
  211. echo >> $TMP/txtTEMP$$
  212. echo "If NO, just press [Enter] on a empty box and skip this." >> $TMP/txtTEMP$$
  213.  
  214. dialog --backtitle "CALLBACK INITIAL LOGIN? ..." --inputbox "`cat $TMP/txtTEMP$$`" 15 74 2> $TMP/cb1.1TEMP$$
  215.  
  216. if [ $? = 1 ]; then
  217. rm -f $TMP/*TEMP*
  218. clear 2>/dev/null || echo
  219. echo "PPP configuration cancelled."
  220. exit 
  221. else
  222. CBMODLOGIN="`cat $TMP/cb1.1TEMP$$`"
  223. fi 
  224. fi
  225.  
  226. if [ -s $TMP/cb1TEMP$$ ]; then
  227. echo "I have your phone number: $CBPN" > $TMP/txtTEMP$$
  228. if [ -s $TMP/cb1.1TEMP$$ ]; then
  229. echo "I see you have to give a Username or Login: $CBMODLOGIN" >> $TMP/txtTEMP$$
  230. echo "for the initial connection to: $PHONENUM" >> $TMP/txtTEMP$$
  231. fi
  232. echo >> $TMP/txtTEMP$$
  233. echo "Do you have to give a Password for the initial connection" >> $TMP/txtTEMP$$
  234. echo "to $PHONENUM before you're called back." >> $TMP/txtTEMP$$
  235. echo >> $TMP/txtTEMP$$
  236. echo "Example: Zoy85mWc" >> $TMP/txtTEMP$$
  237. echo >> $TMP/txtTEMP$$
  238. echo "If NO, just press [Enter] on a empty box and skip this." >> $TMP/txtTEMP$$
  239.  
  240. dialog --backtitle "CALLBACK INITIAL PASSWORD? ..." --inputbox "`cat $TMP/txtTEMP$$`" 17 68 2> $TMP/cb2TEMP$$
  241.  
  242. if [ $? = 1 ]; then
  243. rm -f $TMP/*TEMP*
  244. clear 2>/dev/null || echo
  245. echo "PPP configuration cancelled."
  246. exit 
  247. else
  248. CBMODPASS="`cat $TMP/cb2TEMP$$`"
  249. fi
  250. fi
  251.  
  252. if [ ! -z "$CBPN" ]; then
  253. echo "Are they using PAP or CHAP for AUTHENTICATION? If so answer YES." > $TMP/txtTEMP$$
  254. echo "Do they present you with a Username: or Login: and Password: prompt" >> $TMP/txtTEMP$$
  255. echo "when they call you back, if so they're probably not using PAP or" >> $TMP/txtTEMP$$
  256. echo "CHAP, so you can answer NO here." >> $TMP/txtTEMP$$
  257. echo "If you're not sure, you'll have to ask you're service provider." >> $TMP/txtTEMP$$
  258.  
  259. dialog --backtitle "CALLBACK PAP-CHAP YES or NO? ..." --yesno "`cat $TMP/txtTEMP$$`" 9 72 
  260.  
  261. if [ $? = 1 ]; then
  262. echo "What is your Username or Login to your service provider?" > $TMP/txtTEMP$$
  263. echo >> $TMP/txtTEMP$$
  264. echo "This is the information you'll give them when they call" >> $TMP/txtTEMP$$
  265. echo "you back at: $CBPN" >> $TMP/txtTEMP$$
  266. echo >> $TMP/txtTEMP$$
  267. echo "Example: jerry" >> $TMP/txtTEMP$$
  268.  
  269. dialog --backtitle "CALLBACK LOGIN? ..." --inputbox "`cat $TMP/txtTEMP$$`" 13 72 2> $TMP/cb3TEMP$$
  270.  
  271. if [ $? = 1 ]; then
  272. rm -f $TMP/*TEMP*
  273. clear 2>/dev/null || echo
  274. echo "PPP configuration cancelled."
  275. exit 
  276. fi
  277.  
  278. CBLOGIN="`cat $TMP/cb3TEMP$$`"
  279.  
  280. if [ -z "$CBLOGIN" ]; then
  281. rm -f $TMP/*TEMP*
  282. clear 2>/dev/null || echo
  283. echo "PPP configuration cancelled."
  284. echo "No Login for Callback."
  285. exit 
  286. fi
  287. fi
  288. fi
  289.  
  290. if [ ! -z "$CBLOGIN" ]; then
  291. echo "What is the Password for: $CBLOGIN" > $TMP/txtTEMP$$
  292. echo >> $TMP/txtTEMP$$
  293. echo "Example: Ziy79Kie" >> $TMP/txtTEMP$$
  294. echo >> $TMP/txtTEMP$$
  295.  
  296. dialog --backtitle "CALLBACK PASSWORD? ..." --inputbox "`cat $TMP/txtTEMP$$`" 10 64 2> $TMP/cb4TEMP$$
  297.  
  298. if [ $? = 1 ]; then
  299. rm -f $TMP/*TEMP*
  300. clear 2>/dev/null || echo
  301. echo "PPP configuration cancelled."
  302. exit 1 
  303. fi
  304.  
  305. CBPASS="`cat $TMP/cb4TEMP$$`"
  306.  
  307. if [ -z "$CBPASS" ]; then
  308. rm -f $TMP/*TEMP*
  309. clear 2>/dev/null || echo
  310. echo "PPP configuration cancelled."
  311. echo "No Password for Callback."
  312. exit 1
  313. fi
  314. fi
  315.  
  316. callback1() {
  317.  cat << EOF
  318. TIMEOUT         60
  319. ABORT         BUSY                
  320. ABORT         ERROR                
  321. ABORT         VOICE                
  322. ABORT         "NO CARRIER"           
  323. ABORT         "NO DIALTONE"           
  324. ""         "AT\&FS0=1H0"          
  325. OK         "ATDT$PHONENUM"            
  326. TIMEOUT         60
  327. CONNECT         ""                
  328. ogin:--name: "$CBMODLOGIN"                    
  329. word:--word: "$CBMODPASS"
  330. CLR_ABORT "NO CARRIER"
  331. HANGUP OFF            
  332. TIMEOUT         90
  333. CONNECT         ""
  334. HANGUP 0N
  335. ABORT         "NO CARRIER"           
  336. ogin:--name: "$CBLOGIN"                    
  337. word:--word: "$CBPASS"
  338.  
  339. EOF
  340. }
  341.  
  342. callback2() {
  343.  cat << EOF
  344. TIMEOUT 60
  345. ABORT    BUSY                
  346. ABORT    ERROR                
  347. ABORT    VOICE                
  348. ABORT    "NO CARRIER"           
  349. ABORT    "NO DIALTONE"           
  350. ""    "AT\&FS0=1H0"          
  351. OK    "ATDT$PHONENUM"            
  352. TIMEOUT    60
  353. CONNECT    ""                
  354. CLR_ABORT "NO CARRIER"
  355. HANGUP OFF            
  356. TIMEOUT    90
  357. CONNECT    "\c"
  358. HANGUP 0N
  359. ABORT   "NO CARRIER"           
  360.  
  361. EOF
  362. }
  363.  
  364. callback3() {
  365.  cat << EOF
  366. TIMEOUT         60
  367. ABORT         BUSY                
  368. ABORT         ERROR                
  369. ABORT         VOICE                
  370. ABORT         "NO CARRIER"           
  371. ABORT         "NO DIALTONE"           
  372. ""         "AT\&FS0=1H0"          
  373. OK         "ATDT$PHONENUM"            
  374. TIMEOUT         60
  375. CONNECT         ""                
  376. CLR_ABORT "NO CARRIER"
  377. HANGUP OFF            
  378. TIMEOUT         90
  379. CONNECT         ""
  380. HANGUP 0N
  381. ABORT         "NO CARRIER"           
  382. ogin:--name: "$CBLOGIN"                    
  383. word:--word: "$CBPASS"
  384.  
  385. EOF
  386. }
  387.  
  388. callback4() {
  389.  cat << EOF
  390. TIMEOUT         60
  391. ABORT         BUSY                
  392. ABORT         ERROR                
  393. ABORT         VOICE                
  394. ABORT         "NO CARRIER"           
  395. ABORT         "NO DIALTONE"           
  396. ""         "AT\&FS0=1H0"          
  397. OK         "ATDT$PHONENUM"            
  398. TIMEOUT         60
  399. CONNECT         ""                
  400. word:--word: "$CBMODPASS"            
  401. CLR_ABORT "NO CARRIER"
  402. HANGUP OFF            
  403. TIMEOUT         90
  404. CONNECT         ""
  405. HANGUP 0N
  406. ABORT         "NO CARRIER"           
  407. ogin:--name: "$CBLOGIN"                    
  408. word:--word: "$CBPASS"
  409.  
  410. EOF
  411. }
  412.  
  413. callback5() {
  414.  cat << EOF
  415. TIMEOUT         60
  416. ABORT         BUSY                
  417. ABORT         ERROR                
  418. ABORT         VOICE                
  419. ABORT         "NO CARRIER"           
  420. ABORT         "NO DIALTONE"           
  421. ""         "AT\&FS0=1H0"          
  422. OK         "ATDT$PHONENUM"            
  423. TIMEOUT         60
  424. CONNECT         ""                
  425. ogin:--name: "$CBMODLOGIN"                    
  426. word:--word: "$CBMODPASS"            
  427. CLR_ABORT "NO CARRIER"
  428. HANGUP OFF            
  429. TIMEOUT         90
  430. CONNECT      "\c"           
  431. HANGUP 0N
  432. ABORT         "NO CARRIER"           
  433.  
  434. EOF
  435. }
  436.  
  437. callback6() {
  438.  cat << EOF
  439. TIMEOUT         60
  440. ABORT         BUSY                
  441. ABORT         ERROR                
  442. ABORT         VOICE                
  443. ABORT         "NO CARRIER"           
  444. ABORT         "NO DIALTONE"           
  445. ""         "AT\&FS0=1H0"          
  446. OK         "ATDT$PHONENUM"            
  447. TIMEOUT         60
  448. CONNECT         ""                
  449. ogin:--name: "$CBMODLOGIN"                    
  450. CLR_ABORT "NO CARRIER"
  451. HANGUP OFF            
  452. TIMEOUT         90
  453. CONNECT      "\c"           
  454. HANGUP 0N
  455. ABORT         "NO CARRIER"           
  456.  
  457. EOF
  458. }
  459.  
  460. callback7() {
  461.  cat << EOF
  462. TIMEOUT         60
  463. ABORT         BUSY                
  464. ABORT         ERROR                
  465. ABORT         VOICE                
  466. ABORT         "NO CARRIER"           
  467. ABORT         "NO DIALTONE"           
  468. ""         "AT\&FS0=1H0"          
  469. OK         "ATDT$PHONENUM"            
  470. TIMEOUT         60
  471. CONNECT         ""                
  472. word:--word: "$CBMODPASS"            
  473. CLR_ABORT "NO CARRIER"
  474. HANGUP OFF            
  475. TIMEOUT         90
  476. CONNECT      "\c"           
  477. HANGUP 0N
  478. ABORT         "NO CARRIER"           
  479.  
  480. EOF
  481. }
  482.  
  483. if [ ! -d /etc/ppp ]; then 
  484. mkdir -p /etc/ppp
  485. fi
  486.  
  487. if [ -s $TMP/cb1TEMP$$ ]; then
  488. if [ -s $TMP/cb1.1TEMP$$ ] && [ -s $TMP/cb2TEMP$$ ] && [ -s $TMP/cb3TEMP$$ ] && [ -s $TMP/cb4TEMP$$ ]; then
  489. callback1 > /etc/ppp/callback
  490. elif [ ! -s $TMP/cb1.1TEMP$$ ] && [ ! -s $TMP/cb2TEMP$$ ] && [ ! -s $TMP/cb3TEMP$$ ] && [ ! -s $TMP/cb4TEMP$$ ]; then
  491. callback2 > /etc/ppp/callback
  492. elif [ ! -s $TMP/cb1.1TEMP$$ ] && [ ! -s $TMP/cb2TEMP$$ ] && [ -s $TMP/cb3TEMP$$ ] && [ -s $TMP/cb4TEMP$$ ]; then
  493. callback3 > /etc/ppp/callback
  494. elif [ ! -s $TMP/cb1.1TEMP$$ ] && [ -s $TMP/cb2TEMP$$ ] && [ -s $TMP/cb3TEMP$$ ] && [ -s $TMP/cb4TEMP$$ ]; then
  495. callback4 > /etc/ppp/callback
  496. elif [ -s $TMP/cb1.1TEMP$$ ] && [ -s $TMP/cb2TEMP$$ ] && [ ! -s $TMP/cb3TEMP$$ ] && [ ! -s $TMP/cb4TEMP$$ ]; then
  497. callback5 > /etc/ppp/callback
  498. elif [ -s $TMP/cb1.1TEMP$$ ] && [ ! -s $TMP/cb3TEMP$$ ] && [ ! -s $TMP/cb4TEMP$$ ]; then
  499. callback6 > /etc/ppp/callback
  500. elif [ -s $TMP/cb2TEMP$$ ] && [ ! -s $TMP/cb3TEMP$$ ] && [ ! -s $TMP/cb4TEMP$$ ]; then
  501. callback7 > /etc/ppp/callback
  502. fi
  503. fi
  504.  
  505. if [ -s /etc/ppp/callback ]; then
  506. chown root.root /etc/ppp/callback 2>/dev/null
  507. chmod 600 /etc/ppp/callback 2>/dev/null
  508. fi
  509.  
  510. if [ ! -s $TMP/cb1TEMP$$ ]; then    
  511. echo 'The default modem init string will be: "AT&FH0" OK' > $TMP/txtTEMP$$
  512. echo >> $TMP/txtTEMP$$
  513. echo "If you want to change it, put your init string in the box below." >> $TMP/txtTEMP$$
  514. echo >> $TMP/txtTEMP$$
  515. echo "If you use \ in the init string, put it twice." >> $TMP/txtTEMP$$
  516. echo 'Example: "AT\&F\\K3\\N3H0" OK' >> $TMP/txtTEMP$$
  517. echo "M = No sound.  S95=46 = Show CARRIER speed: 28800 etc." >> $TMP/txtTEMP$$
  518. echo 'Put "" around each init string with "&" in it.' >> $TMP/txtTEMP$$
  519. echo 'Put OK after each init string. Example: ATZ OK "AT\&F1MH0" OK' >> $TMP/txtTEMP$$
  520. echo >> $TMP/txtTEMP$$
  521. echo "Just press [Enter] on a empty box to accept the default above." >> $TMP/txtTEMP$$
  522.  
  523. dialog --backtitle "MODEM INIT STRING ..." --inputbox "`cat $TMP/txtTEMP$$`" 18 74 2> $TMP/rspTEMP$$
  524.  
  525. if [ $? = 1 ]; then
  526. rm -f $TMP/*TEMP*
  527. clear 2>/dev/null || echo
  528. echo "PPP configuration cancelled."
  529. exit 
  530. fi 
  531.  
  532. if [ -s $TMP/rspTEMP$$ ]; then
  533. INIT="`cat $TMP/rspTEMP$$`"
  534. else
  535. INIT="below"
  536. fi
  537. fi
  538.  
  539. echo "What is your (I)nternet (S)ervice (P)rovider's domain name?" > $TMP/txtTEMP$$
  540. echo >> $TMP/txtTEMP$$
  541. echo "This is usually something like..." >> $TMP/txtTEMP$$
  542. echo "Examples: something.edu something.net something.com something.org" >> $TMP/txtTEMP$$
  543. echo >> $TMP/txtTEMP$$
  544.  
  545. dialog --backtitle "DOMAIN NAME ..." --inputbox "`cat $TMP/txtTEMP$$`" 11 74 2> $TMP/rspTEMP$$
  546.  
  547. if [ $? = 1 ]; then
  548. rm -f $TMP/*TEMP*
  549. clear 2>/dev/null || echo
  550. echo "PPP configuration cancelled."
  551. exit 
  552. fi 
  553.  
  554. DOMAINNAME="`cat $TMP/rspTEMP$$`"
  555.  
  556. echo "What is the IP address of your Internet provider's nameserver?" > $TMP/txtTEMP$$
  557. echo >> $TMP/txtTEMP$$
  558. echo "It's important that these IP numbers be correct." >> $TMP/txtTEMP$$
  559. echo "The IP numbers should not be: 0.0.0.0" >> $TMP/txtTEMP$$
  560. echo >> $TMP/txtTEMP$$
  561. echo "Note: Your service provider's technical support can provide you" >> $TMP/txtTEMP$$
  562. echo "with this information.   Example: 207.132.116.5" >> $TMP/txtTEMP$$
  563. echo >> $TMP/txtTEMP$$
  564.  
  565. dialog --backtitle "DNS IP ADDRESS ..." --inputbox "`cat $TMP/txtTEMP$$`" 14 74 2> $TMP/rspTEMP$$
  566.  
  567. if [ $? = 1 ]; then
  568. rm -f $TMP/*TEMP*
  569. clear 2>/dev/null || echo
  570. echo "PPP configuration cancelled."
  571. exit 
  572. fi 
  573.  
  574. DNSIP="`cat $TMP/rspTEMP$$`"
  575.  
  576. if [ ! -s $TMP/cb3TEMP$$ ]; then   
  577. echo "Does your service provider use PAP or CHAP?" > $TMP/txtTEMP$$
  578. echo "If you're presented with a Username: or Login: and Password:" >> $TMP/txtTEMP$$
  579. echo "prompt when you connect to your service provider, they're" >> $TMP/txtTEMP$$
  580. echo "'probably' not using PAP or CHAP, so you can answer SCRIPT." >> $TMP/txtTEMP$$
  581. echo "I said 'probably', the only way to know for sure is to ask you're" >> $TMP/txtTEMP$$
  582. echo "service provider, this could save you a lot of wasted time." >> $TMP/txtTEMP$$
  583.  
  584. dialog --backtitle "PAP, CHAP, or SCRIPT? ..." --menu "`cat $TMP/txtTEMP$$`" 16 72 4 \
  585. PAP  "AUTHENTICATION" \
  586. CHAP "AUTHENTICATION" \
  587. MS-CHAP-80 "is microsoft's version of CHAP." \
  588. SCRIPT     "Create Chat Script For Login." 2> $TMP/papTEMP
  589.  
  590. if [ $? = 1 ]; then
  591. rm -f $TMP/*TEMP*
  592. clear 2>/dev/null || echo
  593. echo "PPP configuration cancelled."
  594. exit 
  595. else
  596. PAP="`cat $TMP/papTEMP`"
  597. fi
  598. fi
  599.  
  600. RAS() {
  601. cat << EOF
  602. If your RAS server is not the 'domain controller' and is not a 
  603. 'stand-alone' server, then it must make a query to the domain 
  604. controller for your domain.
  605.  
  606. In other words, your account is not on the NT server you first 
  607. connect to, so it needs to know the name of the domain you have 
  608. your account on, so it can query that domain about you. 
  609.  
  610. If not sure chose Stand-alone, then try Queries if Stand-alone 
  611. doesn't work.
  612. EOF
  613. }
  614.  
  615. if [ "$PAP" = "MS-CHAP-80" ]; then   
  616. if [ ! -z "$DOMAINNAME" ]; then
  617. echo > $TMP/txtTEMP$$
  618. echo "You gave $DOMAINNAME for domain name, this will be the" >> $TMP/txtTEMP$$
  619. echo "NT server you connect to when you dial: $PHONENUM" >> $TMP/txtTEMP$$
  620. echo >> $TMP/txtTEMP$$
  621. else
  622. echo > $TMP/txtTEMP$$
  623. fi
  624. RAS >> $TMP/txtTEMP$$
  625.  
  626. dialog --title "MS-CHAP NT server, Stand-alone or ? ..." --menu "`cat $TMP/txtTEMP$$`" 22 72 2 \
  627. MS-CHAP-SERVER-1 "Stand-alone..." \
  628. MS-CHAP-SERVER-2 "Queries domain controller..." 2> $TMP/mschapTEMP
  629.  
  630. if [ $? = 1 ]; then
  631. rm -f $TMP/*TEMP*
  632. clear 2>/dev/null || echo
  633. echo "PPP configuration cancelled."
  634. exit 
  635. fi 
  636.  
  637. MSCHAP="`cat $TMP/mschapTEMP`"
  638.  
  639. if [ "$MSCHAP" = "MS-CHAP-SERVER-2" ]; then   
  640. echo "Put the name of the domain you have your account on." > $TMP/txtTEMP0
  641. echo "Example: fooboo" >> $TMP/txtTEMP0
  642. echo >> $TMP/txtTEMP0
  643.  
  644. dialog --backtitle "MS-CHAP QUERY DOMAIN? ..." --inputbox "`cat $TMP/txtTEMP0`" 9 64 2> $TMP/rspTEMP0
  645.  
  646. if [ $? = 1 ]; then
  647. rm -f $TMP/*TEMP*
  648. clear 2>/dev/null || echo
  649. echo "PPP configuration cancelled."
  650. exit 
  651. fi 
  652.  
  653. MSDOMAIN="`cat $TMP/rspTEMP0`"
  654.  
  655. if [ ! -s $TMP/rspTEMP0 ]; then   
  656. rm -f $TMP/*TEMP*
  657. clear 2>/dev/null || echo
  658. echo "PPP configuration cancelled."
  659. echo "No ms-chap query domain name given."
  660. exit
  661. fi 
  662. fi
  663. fi
  664.  
  665. if [ ! "$PAP" = "SCRIPT" ] && [ ! -s $TMP/cb3TEMP$$ ]; then   
  666. echo "Put your Login = Username in the box below." > $TMP/txtTEMP1
  667. echo >> $TMP/txtTEMP1
  668. echo "Sometimes they want your username or number followed" >> $TMP/txtTEMP1
  669. echo "by their @domain name like this below." >> $TMP/txtTEMP1
  670. echo "Example: jerry@foo.boo.com" >> $TMP/txtTEMP1
  671. echo "Example: 1234567@foo.boo.com" >> $TMP/txtTEMP1
  672. echo >> $TMP/txtTEMP1
  673. echo "Sometimes the username is two words." >> $TMP/txtTEMP1
  674. echo "Example: jerry donut" >> $TMP/txtTEMP1
  675. echo >> $TMP/txtTEMP1
  676. echo "Usally it's just your username like this below." >> $TMP/txtTEMP1
  677. echo "Example: jerry" >> $TMP/txtTEMP1
  678. echo >> $TMP/txtTEMP1
  679.  
  680. dialog --backtitle "PAP or CHAP LOGIN? ..." --inputbox "`cat $TMP/txtTEMP1`" 19 64 2> $TMP/rspTEMP1
  681.  
  682. if [ $? = 1 ]; then
  683. rm -f $TMP/*TEMP*
  684. clear 2>/dev/null || echo
  685. echo "PPP configuration cancelled."
  686. exit 
  687. fi
  688.  
  689. if [ ! -s $TMP/rspTEMP1 ]; then   
  690. rm -f $TMP/*TEMP*
  691. clear 2>/dev/null || echo
  692. echo "PPP configuration cancelled."
  693. echo "No username for pap, chap, or ms-chap given."
  694. exit
  695. fi 
  696. fi
  697.  
  698. if [ -s $TMP/rspTEMP1 ]; then 
  699. AUTH1="`cat $TMP/rspTEMP1`"
  700. echo "$AUTH1" > $TMP/txtTEMP2
  701. echo "What's the password for the username above?" >> $TMP/txtTEMP2
  702. echo "Example: Xpi9u87T" >> $TMP/txtTEMP2
  703. dialog --backtitle "PAP or CHAP PASSWORD? ..." --inputbox "`cat $TMP/txtTEMP2`" 10 64 2> $TMP/rspTEMP2
  704.  
  705. AUTH2="`cat $TMP/rspTEMP2`"
  706. END=""
  707.  
  708. elif [ ! -s $TMP/cb1TEMP$$ ] && [ "$PAP" = "SCRIPT" ]; then  
  709. END='""'
  710. echo "If you reached this part of the script, it should be because you" > $TMP/txtTEMP$$
  711. echo "skipped the PAP or CHAP? and CALLBACK? parts of this script." >> $TMP/txtTEMP$$
  712. echo "In other words, your service provider is not using PAP, CHAP, or" >> $TMP/txtTEMP$$
  713. echo "CALLBACK." >> $TMP/txtTEMP$$
  714. echo >> $TMP/txtTEMP$$
  715. echo "Now comes the tough part. :) I need to know what your" >> $TMP/txtTEMP$$
  716. echo "service provider prints to your screen when you dial in," >> $TMP/txtTEMP$$
  717. echo "and what you respond with." >> $TMP/txtTEMP$$
  718. echo >> $TMP/txtTEMP$$
  719. echo "Usally when you connect to your service provider you see a" >> $TMP/txtTEMP$$
  720. echo "Username: or Login: prompt, and you respond with your name." >> $TMP/txtTEMP$$
  721. echo "Then there's a Password: prompt and you respond with your" >> $TMP/txtTEMP$$
  722. echo "password." >> $TMP/txtTEMP$$
  723. echo >> $TMP/txtTEMP$$
  724. echo "If you're not sure if it's Login: or login:, just put ogin:" >> $TMP/txtTEMP$$
  725. echo "you don't have to spell the whole thing out, the end part of" >> $TMP/txtTEMP$$
  726. echo "what to wait for should be enough." >> $TMP/txtTEMP$$
  727. echo >> $TMP/txtTEMP$$
  728. echo 'If they put this for example "foobar fooboo ID:", you could just' >> $TMP/txtTEMP$$
  729. echo 'put ID: or you could spell the whole thing out & put "" around it.' >> $TMP/txtTEMP$$
  730. echo >> $TMP/txtTEMP$$
  731. echo "What text should I wait for?" >> $TMP/txtTEMP$$
  732. echo "ID:" >> $TMP/txtTEMP$$
  733. echo "What text should I send?" >> $TMP/txtTEMP$$
  734. echo "jerry" >> $TMP/txtTEMP$$
  735. echo "What text should I wait for?" >> $TMP/txtTEMP$$
  736. echo '"foobar fooboo ID:"' >> $TMP/txtTEMP$$
  737. echo "What text should I send?" >> $TMP/txtTEMP$$
  738. echo "jerry" >> $TMP/txtTEMP$$
  739. echo >> $TMP/txtTEMP$$
  740. echo "Sometimes you may want to wait for nothing, but send something." >> $TMP/txtTEMP$$
  741. echo >> $TMP/txtTEMP$$
  742. echo "What text should I wait for?" >> $TMP/txtTEMP$$
  743. echo '""' >> $TMP/txtTEMP$$
  744. echo "What text should I send?" >> $TMP/txtTEMP$$
  745. echo "something" >> $TMP/txtTEMP$$
  746. echo >> $TMP/txtTEMP$$
  747. echo '"" = wait for nothing.' >> $TMP/txtTEMP$$
  748. echo >> $TMP/txtTEMP$$
  749. echo "If you don't want your password printed out put \q in front of it." >> $TMP/txtTEMP$$
  750. echo >> $TMP/txtTEMP$$
  751. echo "What text should I wait for?" >> $TMP/txtTEMP$$
  752. echo "Password:" >> $TMP/txtTEMP$$
  753. echo "What text should I send?" >> $TMP/txtTEMP$$
  754. echo "\qsecret" >> $TMP/txtTEMP$$
  755. echo >> $TMP/txtTEMP$$
  756. echo "ogin: = Login:   name: = Username:   word: = Password:" >> $TMP/txtTEMP$$
  757. echo >> $TMP/txtTEMP$$
  758. echo "This below would end up looking like this in the /etc/ppp/pppscript" >> $TMP/txtTEMP$$
  759. echo "file created by pppsetup when you're done." >> $TMP/txtTEMP$$
  760. echo >> $TMP/txtTEMP$$
  761. echo "ogin: jerry" >> $TMP/txtTEMP$$
  762. echo "word: secret" >> $TMP/txtTEMP$$
  763. echo >> $TMP/txtTEMP$$
  764. echo "For example..." >> $TMP/txtTEMP$$
  765. echo >> $TMP/txtTEMP$$
  766. echo "What text should I wait for?" >> $TMP/txtTEMP$$
  767. echo "ogin:" >> $TMP/txtTEMP$$
  768. echo "And what text should I send?" >> $TMP/txtTEMP$$
  769. echo "jerry" >> $TMP/txtTEMP$$
  770. echo "What text should I wait for?" >> $TMP/txtTEMP$$
  771. echo "word:" >> $TMP/txtTEMP$$
  772. echo "And what text should I send?" >> $TMP/txtTEMP$$
  773. echo "secret" >> $TMP/txtTEMP$$
  774. echo "What text should I wait for?" >> $TMP/txtTEMP$$
  775. echo >> $TMP/txtTEMP$$
  776. echo "( End by pressing Enter on an empty = blank wait for? box. )" >> $TMP/txtTEMP$$
  777.  
  778. dialog --title "CHAT SCRIPT" --textbox "$TMP/txtTEMP$$" 22 72
  779.  
  780. MESSAGE=' '
  781. YOUSAY=' '
  782. while [ ! "$MESSAGE" = "" -a ! "$YOUSAY" = "" ]
  783. do
  784.  
  785. echo "     End by pressing Enter on a empty = blank box." > $TMP/txtTEMP$$
  786. echo "            What text should I wait for?" >> $TMP/txtTEMP$$
  787. dialog --backtitle "EXPECT ..." --inputbox "`cat $TMP/txtTEMP$$`" 9 60 2> $TMP/rspTEMP$$    
  788.  
  789. MESSAGE="`cat $TMP/rspTEMP$$`"
  790.  
  791. if [ -z "$MESSAGE" ]; then
  792. continue
  793. fi
  794.  
  795. dialog --backtitle "SEND ..." --inputbox "And what text should I send?" 8 60 2> $TMP/rspTEMP$$
  796.  
  797. if [ $? = 1 ]; then
  798. rm -f $TMP/*TEMP*
  799. clear 2>/dev/null || echo
  800. echo "PPP configuration cancelled."
  801. exit 
  802. fi
  803.  
  804. YOUSAY="`cat $TMP/rspTEMP$$`"
  805.  
  806. echo "$MESSAGE $YOUSAY" >> $TMP/sayTEMP1
  807.     
  808. if [ -z "$YOUSAY" ]; then
  809. clear 2>/dev/null || echo
  810. rm -f $TMP/*TEMP*
  811. echo "PPP configuration cancelled."
  812. echo "Nothing to send."
  813. exit 
  814. else    
  815. continue
  816. fi
  817. done
  818. fi
  819.  
  820. if [ ! -s $TMP/cb3TEMP$$ ]; then
  821. if [ -s $TMP/cb1TEMP$$ ] && [ ! -s $TMP/cb3TEMP$$ ] && [ "$PAP" = "SCRIPT" ]; then
  822. clear 2>/dev/null || echo
  823. rm -f $TMP/*TEMP*
  824. echo "PPP configuration cancelled."
  825. echo "You chose callback with PAP or CHAP, but answered SCRIPT to PAP or CHAP?."
  826. exit 
  827. elif [ ! -s $TMP/rspTEMP2 ] && [ -s $TMP/rspTEMP1 ]; then
  828. clear 2>/dev/null || echo
  829. rm -f $TMP/*TEMP*
  830. echo "PPP configuration cancelled."
  831. echo "No password for: $AUTH1"
  832. exit     
  833. elif [ ! -s $TMP/sayTEMP1 ] && [ ! -s $TMP/rspTEMP2 ]; then
  834. clear 2>/dev/null || echo
  835. rm -f $TMP/*TEMP*
  836. echo "PPP configuration cancelled."
  837. echo "Nothing to wait for."
  838. exit 
  839. fi
  840. fi
  841.  
  842. if dmesg 2>/dev/null | grep "PPP: version" >/dev/null 2>&1 ; then
  843. MSG1=YES
  844. fi
  845. if [ -s /lib/modules/`uname -r 2>/dev/null`/net/ppp.o ]; then
  846. MSG2=YES
  847. fi
  848.  
  849. if [ ! -s /etc/host.conf ]; then
  850. echo "order hosts,bind" > /etc/host.conf
  851. echo "multi on" >> /etc/host.conf
  852. fi
  853.  
  854. if [ ! -z $DOMAINNAME ]; then        
  855. echo "search $DOMAINNAME" > /etc/resolv.conf
  856. else
  857. rm -f /etc/resolv.conf 2>/dev/null 
  858. DOMAINNAME="unknown.com"
  859. fi
  860.  
  861. if [ -z $DNSIP ]; then
  862. echo "nameserver 207.132.116.5" >> /etc/resolv.conf
  863. else
  864. echo "nameserver $DNSIP" >> /etc/resolv.conf
  865. fi
  866.  
  867. if [ ! -s /etc/hosts ]; then
  868. echo "127.0.0.1    localhost" > /etc/hosts
  869. if [ "$DOMAINNAME" = "unknown.com" ]; then
  870. echo "0.0.0.0     `hostname 2>/dev/null`.localnet `hostname 2>/dev/null`" >> /etc/hosts
  871. else
  872. echo "0.0.0.0     `hostname 2>/dev/null`.$DOMAINNAME `hostname 2>/dev/null`" >> /etc/hosts
  873. fi
  874. fi
  875.  
  876. if [ -x /usr/sbin/pppd ]; then
  877. PATH1="/usr/sbin/pppd"
  878. elif [ -x /usr/bin/pppd ]; then
  879. PATH1="/usr/bin/pppd"
  880. elif [ -x /usr/local/bin/pppd ]; then
  881. PATH1="/usr/local/bin/pppd"
  882. elif [ -x /bin/pppd ]; then
  883. PATH1="/bin/pppd"
  884. elif [ -x /sbin/pppd ]; then
  885. PATH1="/sbin/pppd"
  886. else
  887. PATH1="pppd"
  888. fi
  889.  
  890. #if [ "$PATH1" != "pppd" ]; then
  891. #chmod 4755 $PATH1 2>/dev/null
  892. #fi
  893.  
  894. if [ -x /usr/sbin/chat ]; then
  895. PATH2="/usr/sbin/chat"
  896. elif [ -x /usr/bin/chat ]; then
  897. PATH2="/usr/bin/chat"
  898. elif [ -x /usr/local/bin/chat ]; then
  899. PATH2="/usr/local/bin/chat"
  900. elif [ -x /bin/chat ]; then
  901. PATH2="/bin/chat"
  902. elif [ -x /sbin/chat ]; then
  903. PATH2="/sbin/chat"
  904. else
  905. PATH2="chat"
  906. fi
  907.  
  908. if [ ! -s $TMP/cb1TEMP$$ ]; then
  909. echo "TIMEOUT 60" > /etc/ppp/pppscript
  910. echo "ABORT ERROR" >> /etc/ppp/pppscript 
  911. echo "ABORT BUSY" >> /etc/ppp/pppscript 
  912. echo 'ABORT "NO CARRIER"' >> /etc/ppp/pppscript
  913. echo 'ABORT "NO DIALTONE"' >> /etc/ppp/pppscript
  914. if [ "$INIT" = "below" ]; then
  915. echo '"" "AT&FH0"' >> /etc/ppp/pppscript
  916. echo 'OK "'$PHONENUM'"' >> /etc/ppp/pppscript
  917. else
  918. echo '"" '$INIT'' >> /etc/ppp/pppscript
  919. echo '"'$PHONENUM'"' >> /etc/ppp/pppscript
  920. fi
  921. echo "TIMEOUT 75" >> /etc/ppp/pppscript
  922. echo 'CONNECT '$END'' >> /etc/ppp/pppscript
  923. chown root.root /etc/ppp/pppscript 2>/dev/null
  924. chmod 600 /etc/ppp/pppscript 2>/dev/null
  925. fi
  926.  
  927. if [ -s $TMP/sayTEMP1 ]; then
  928. cat $TMP/sayTEMP1 >> /etc/ppp/pppscript
  929. echo >> /etc/ppp/pppscript 
  930. else
  931. echo >> /etc/ppp/pppscript 
  932. fi
  933.  
  934. if [ -s /etc/ppp/ip-up ]; then
  935. mv /etc/ppp/ip-up /etc/ppp/ip-up.OLD
  936. fi
  937.  
  938. echo "#!/bin/sh" > /etc/ppp/ip-up
  939.  
  940. echo "#" >> /etc/ppp/ip-up
  941. echo "# This file /etc/ppp/ip-up is run by pppd when there's a" >> /etc/ppp/ip-up
  942. echo "# successful ppp connection." >> /etc/ppp/ip-up
  943. echo "#" >> /etc/ppp/ip-up
  944. echo "# Put any commands you want run after a successful connection" >> /etc/ppp/ip-up
  945. echo "# in this file." >> /etc/ppp/ip-up
  946. echo "#" >> /etc/ppp/ip-up
  947. echo "# Any commands you want printed to the screen should be directed" >> /etc/ppp/ip-up
  948. echo "# to: >/dev/tty0" >> /etc/ppp/ip-up
  949. echo "#" >> /etc/ppp/ip-up
  950. echo "# Other commands should not be directed to: >/dev/tty0" >> /etc/ppp/ip-up
  951. echo "#" >> /etc/ppp/ip-up
  952. echo "# The companion file is /etc/ppp/ip-down, it's run when the PPP" >> /etc/ppp/ip-up
  953. echo "# connection ends." >> /etc/ppp/ip-up
  954. echo "#" >> /etc/ppp/ip-up
  955. echo "# This file is created when you run pppsetup: `date 2>/dev/null`" >> /etc/ppp/ip-up
  956. echo "#" >> /etc/ppp/ip-up
  957. echo "# The environment is cleared before executing this script" >> /etc/ppp/ip-up
  958. echo "# so the path must be reset." >> /etc/ppp/ip-up
  959. echo "#" >> /etc/ppp/ip-up
  960. echo "PATH=/usr/bin:/usr/sbin:/usr/local/bin:/sbin:/bin" >> /etc/ppp/ip-up
  961. echo "export PATH" >> /etc/ppp/ip-up
  962.  
  963. echo >> /etc/ppp/ip-up
  964. echo "# This will print to the screen the local & remote IP address when you" >> /etc/ppp/ip-up
  965. echo '# make a successful ppp connection.  $4 = Local IP $5 = Remote IP' >> /etc/ppp/ip-up
  966. echo "#" >> /etc/ppp/ip-up
  967. echo "# The CARRIER speed at which you connected will be reported, if it's in" >> /etc/ppp/ip-up
  968. echo '# the /var/log/messages file.  You also need the programs "tail" "cut"' >> /etc/ppp/ip-up
  969. echo '# "tr" "grep" and "syslogd" running for this to work.' >> /etc/ppp/ip-up
  970. echo "# You may have to add S95=46 to your modem init string" >> /etc/ppp/ip-up
  971. echo "# to get your modem to report the DCE = CARRIER speed." >> /etc/ppp/ip-up
  972. echo "# Example: AT&FS95=46" >> /etc/ppp/ip-up
  973.  
  974. echo >> /etc/ppp/ip-up
  975. echo "if [ -s /var/log/messages ] && ( ps xc 2>/dev/null | grep -q syslogd 2>/dev/null ); then" >> /etc/ppp/ip-up
  976. echo 'S=`tail -n 30 /var/log/messages 2>/dev/null | grep "CARRIER[^)]" 2>/dev/null | tr -d "^M" 2>/dev/null | cut -d: -f4 2>/dev/null`' >> /etc/ppp/ip-up
  977. echo 'echo -n "$S" >/dev/tty0' >> /etc/ppp/ip-up
  978. echo 'echo " Local: $4 -> Remote: $5 $1" >/dev/tty0' >> /etc/ppp/ip-up
  979. echo "else" >> /etc/ppp/ip-up
  980. echo 'echo " Local: $4 -> Remote: $5 $1" >/dev/tty0' >> /etc/ppp/ip-up
  981. echo "fi" >> /etc/ppp/ip-up
  982.  
  983. echo >> /etc/ppp/ip-up
  984. echo "# If you want to ping the other end to keep the connection open." >> /etc/ppp/ip-up
  985. echo "# The output from ping will goto >/dev/null, you won't see it." >> /etc/ppp/ip-up
  986. echo '# Ping -i 60 = send ping every 60 seconds to remote = $5.' >> /etc/ppp/ip-up
  987.  
  988. echo >> /etc/ppp/ip-up
  989. echo '#(ping -i 60 $5 &) >/dev/null 2>&1' >> /etc/ppp/ip-up
  990.  
  991. echo >> /etc/ppp/ip-up
  992. echo "# If you want sendmail to send any mail in /var/spool/mqueue when" >> /etc/ppp/ip-up
  993. echo "# you connect, remove the # below." >> /etc/ppp/ip-up
  994.  
  995. echo >> /etc/ppp/ip-up
  996. echo "#sendmail -q" >> /etc/ppp/ip-up
  997.  
  998. echo >> /etc/ppp/ip-up
  999. echo "# If you want fetchmail to get your mail when you connect and check" >> /etc/ppp/ip-up
  1000. echo "# every 300 seconds = 5 minutes for mail, remove the # below." >> /etc/ppp/ip-up
  1001.  
  1002. echo >> /etc/ppp/ip-up
  1003. echo "#fetchmail -d 300" >> /etc/ppp/ip-up
  1004.  
  1005. echo >> /etc/ppp/ip-up
  1006. echo "# End..." >> /etc/ppp/ip-up
  1007.  
  1008. #chmod 4755 /etc/ppp/ip-up 2>/dev/null
  1009. chmod 755 /etc/ppp/ip-up 2>/dev/null
  1010.  
  1011. if [ -s /etc/ppp/ip-down ]; then
  1012. mv /etc/ppp/ip-down /etc/ppp/ip-down.OLD
  1013. fi
  1014.  
  1015. ipdown() {
  1016. cat <<EOF
  1017. #!/bin/sh
  1018. #
  1019. # This script is run by pppd after the PPP connection is ended.
  1020. #
  1021. # The companion file is /etc/ppp/ip-up, it's run when the PPP
  1022. # connection is started.
  1023. #
  1024. # This file is created when you run pppsetup: `date 2>/dev/null`
  1025. #
  1026. # The environment is cleared before executing this script
  1027. # so the path must be reset.
  1028. #
  1029. PATH=/usr/sbin:/sbin:/usr/bin:/usr/local/bin:/bin
  1030. export PATH
  1031.  
  1032. # Stop ping if you started it in /etc/ppp/ip-up.
  1033.  
  1034. #killall ping 2>/dev/null
  1035.  
  1036. # Stop the fetchmail daemon if you started it in /etc/ppp/ip-up
  1037. # with 'fetchmail -d 300'.
  1038.  
  1039. #fetchmail -q
  1040.  
  1041. # Send "ath" = hangup etc. to modem when ppp connection ends.
  1042. # You'll see the modem reponse OK and date in the /etc/ppp/modem.cua?, 
  1043. # modem.ttyS?, or modem.modem file.
  1044. # You need the 'modem-stats' program for this below to work.
  1045. # ftp://metalab.unc.edu/pub/apps/serialcomm/modem 
  1046. # modem-stats-1.0.1.src.elf.tar.gz
  1047. # Remove the ##### from the lines below.
  1048.  
  1049. EOF
  1050. }
  1051.  
  1052. ipdown > /etc/ppp/ip-down
  1053. #chmod 4755 /etc/ppp/ip-down 2>/dev/null
  1054. chmod 755 /etc/ppp/ip-down 2>/dev/null
  1055.  
  1056. echo "#sleep 2   # Make sure the modem is really down." >> /etc/ppp/ip-down
  1057. echo '#DEV=`echo $2 | sed -e "s./dev/.."`' >> /etc/ppp/ip-down
  1058. echo '#echo "--------------------------" >> /etc/ppp/modem.$DEV' >> /etc/ppp/ip-down
  1059. echo '#date                              >> /etc/ppp/modem.$DEV' >> /etc/ppp/ip-down
  1060. echo '#modem-stats -c "ath" $2           >> /etc/ppp/modem.$DEV' >> /etc/ppp/ip-down
  1061. echo >> /etc/ppp/ip-down
  1062. echo "# End..." >> /etc/ppp/ip-down
  1063.  
  1064. echo "#!/bin/bash" > /usr/sbin/ppp-go
  1065.  
  1066. echo >> /usr/sbin/ppp-go
  1067. echo "ifconnect() {" >> /usr/sbin/ppp-go
  1068. echo >> /usr/sbin/ppp-go
  1069. echo 'if ! ( ifconfig | grep "P-t-P" >/dev/null ); then' >> /usr/sbin/ppp-go 
  1070. echo 'echo "* NO! not PPP connected. *"' >> /usr/sbin/ppp-go
  1071. echo "echo" >> /usr/sbin/ppp-go
  1072. echo "else" >> /usr/sbin/ppp-go
  1073. echo "exit 0" >> /usr/sbin/ppp-go
  1074. echo "fi" >> /usr/sbin/ppp-go
  1075.  
  1076. echo >> /usr/sbin/ppp-go
  1077. echo "if [ -s /var/log/debug ] && ( ps xc 2>/dev/null | grep -q syslogd 2>/dev/null ); then" >> /usr/sbin/ppp-go
  1078. echo 'echo "Look at /var/log/messages and or debug for more info."' >> /usr/sbin/ppp-go
  1079. echo "echo" >> /usr/sbin/ppp-go
  1080. echo "else" >> /usr/sbin/ppp-go
  1081. echo "exit 0" >> /usr/sbin/ppp-go
  1082. echo "fi" >> /usr/sbin/ppp-go
  1083.  
  1084. echo >> /usr/sbin/ppp-go
  1085. echo 'echo "Do you want to see /var/log/messages & debug?"' >> /usr/sbin/ppp-go
  1086. echo 'echo "The PAGER less or more will be used: Q = Quit!"' >> /usr/sbin/ppp-go
  1087. echo 'echo "The last 30 lines of each file will be shown, there"' >> /usr/sbin/ppp-go
  1088. echo 'echo -n "may be some overlap from previous attempts: (N/y) : "' >> /usr/sbin/ppp-go
  1089. echo "read ans" >> /usr/sbin/ppp-go
  1090.  
  1091. echo >> /usr/sbin/ppp-go
  1092. echo 'if [ "$ans" = "y" -o "$ans" = "Y" ]; then' >> /usr/sbin/ppp-go
  1093. echo 'tail -n 30 /var/log/messages /var/log/debug 2>/dev/null | less -aCMrsi || more -ds || echo "No PAGER found, no more or less."' >> /usr/sbin/ppp-go
  1094. echo "grepauth" >> /usr/sbin/ppp-go
  1095. echo "else" >> /usr/sbin/ppp-go
  1096. echo "grepauth" >> /usr/sbin/ppp-go
  1097. echo "fi" >> /usr/sbin/ppp-go
  1098. echo "}" >> /usr/sbin/ppp-go
  1099.  
  1100. auth() {
  1101. cat <<EOF
  1102. grepauth() {
  1103.  
  1104. tail -n 30 /var/log/debug 2>/dev/null | grep -i -s "rcvd" > $TMP/grep.tmp
  1105.  
  1106. if ( grep -i -q "auth pap" $TMP/grep.tmp ); then
  1107. echo
  1108. echo "They seem to be requesting PAP = <auth pap> for authentication."
  1109. echo "I don't know if you're setup for 'PAP' or not."
  1110. echo "Did you answer 'PAP' when you ran pppsetup?"
  1111. echo
  1112. elif ( grep -E -i -q "auth chap msoft|auth chap 80" $TMP/grep.tmp ); then
  1113. echo
  1114. echo "They seem to be requesting MS-CHAP-80 = <auth chap 80> for authentication."
  1115. echo "I don't know if you're setup for 'MS-CHAP' or not."
  1116. echo "Did you answer 'MS-CHAP' when you ran pppsetup?"
  1117. echo
  1118. elif ( grep -i -q "auth chap" $TMP/grep.tmp ); then
  1119. echo "They seem to be requesting CHAP = <auth chap> for authentication."
  1120. echo "I don't know if you're setup for 'CHAP' or not."
  1121. echo "Did you answer 'CHAP' when you ran pppsetup?"
  1122. echo
  1123. else
  1124. rm -f $TMP/grep.tmp
  1125. exit 0
  1126. fi
  1127.  
  1128. if ( grep -i -q "callback" $TMP/grep.tmp ); then
  1129. echo "They seem to be requesting CALLBACK."
  1130. echo "I don't know if you're setup for 'callback' or not."
  1131. echo "Did you answer 'CALLBACK' when you ran pppsetup?"
  1132. echo
  1133. fi
  1134.  
  1135. rm -f $TMP/grep.tmp
  1136. }
  1137. EOF
  1138. }
  1139.  
  1140. echo >> /usr/sbin/ppp-go
  1141. auth >> /usr/sbin/ppp-go
  1142.  
  1143. echo >> /usr/sbin/ppp-go
  1144. echo 'if [ "$1" = "" ]; then' >> /usr/sbin/ppp-go
  1145. echo "killall -INT pppd 2>/dev/null" >> /usr/sbin/ppp-go
  1146. echo "rm -f /var/lock/LCK* /var/run/ppp*.pid" >> /usr/sbin/ppp-go
  1147.  
  1148. if [ -s $TMP/cb1TEMP$$ ]; then
  1149. echo '('$PATH1' -detach connect "'$PATH2' -v -f /etc/ppp/callback" &) || exit 1' >> /usr/sbin/ppp-go
  1150. else
  1151. echo '('$PATH1' -detach connect "'$PATH2' -v -f /etc/ppp/pppscript" &) || exit 1' >> /usr/sbin/ppp-go
  1152. fi
  1153.  
  1154. echo "#read" >> /usr/sbin/ppp-go
  1155. echo "#ifconnect" >> /usr/sbin/ppp-go
  1156. echo "exit 0" >> /usr/sbin/ppp-go
  1157. echo "fi" >> /usr/sbin/ppp-go
  1158.  
  1159. echo >> /usr/sbin/ppp-go
  1160. echo 'if [ "$1" = "-q" ]; then' >> /usr/sbin/ppp-go
  1161. echo "killall -INT pppd 2>/dev/null" >> /usr/sbin/ppp-go
  1162. echo "rm -f /var/lock/LCK* /var/run/ppp*.pid" >> /usr/sbin/ppp-go
  1163.  
  1164. if [ -s $TMP/cb1TEMP$$ ]; then
  1165. echo '('$PATH1' connect "'$PATH2' -v -f /etc/ppp/callback" 1> /dev/null 2> /dev/null ) || exit 1' >> /usr/sbin/ppp-go
  1166. else
  1167. echo '('$PATH1' connect "'$PATH2' -v -f /etc/ppp/pppscript" 1> /dev/null 2> /dev/null ) || exit 1' >> /usr/sbin/ppp-go
  1168. fi
  1169.  
  1170. echo "exit 0" >> /usr/sbin/ppp-go
  1171. echo "fi" >> /usr/sbin/ppp-go
  1172.  
  1173. echo >> /usr/sbin/ppp-go
  1174. echo 'if [ "$1" = "-d" ]; then' >> /usr/sbin/ppp-go
  1175. echo "killall -INT pppd 2>/dev/null" >> /usr/sbin/ppp-go
  1176. echo "rm -f /var/lock/LCK* /var/run/ppp*.pid" >> /usr/sbin/ppp-go
  1177. echo '('$PATH1' file "/etc/ppp/options.demand" &) || exit 1' >> /usr/sbin/ppp-go
  1178. echo 'echo "Demand Dialing Started."' >> /usr/sbin/ppp-go
  1179. echo "exit 0" >> /usr/sbin/ppp-go
  1180. echo "fi" >> /usr/sbin/ppp-go
  1181.  
  1182. echo >> /usr/sbin/ppp-go
  1183. echo 'if [ "$1" = "-h" ]; then' >> /usr/sbin/ppp-go
  1184. echo 'echo "USAGE: ppp-go    <Make PPP connection, print messages to screen.>"' >> /usr/sbin/ppp-go
  1185. echo 'echo "USAGE: ppp-go -q <Make PPP connection, do not print messages to screen.>"' >> /usr/sbin/ppp-go
  1186. echo 'echo "USAGE: ppp-go -r <Remove contents of /var/log/messages & debug files.>"' >> /usr/sbin/ppp-go
  1187. echo 'echo "USAGE: ppp-go -d <Put pppd in demand dialing mode.>"' >> /usr/sbin/ppp-go
  1188. echo 'echo "USAGE: ppp-go -h <Help>"' >> /usr/sbin/ppp-go
  1189. echo "exit 0" >> /usr/sbin/ppp-go
  1190. echo "fi" >> /usr/sbin/ppp-go
  1191.  
  1192. echo >> /usr/sbin/ppp-go
  1193. echo 'if [ "$1" = "-r" ]; then' >> /usr/sbin/ppp-go
  1194. echo 'echo -n "Remove contents of /var/log/messages file? (N/y) : "' >> /usr/sbin/ppp-go
  1195. echo "read ans" >> /usr/sbin/ppp-go
  1196. echo 'if [ "$ans" = "y" -o "$ans" = "Y" ]; then' >> /usr/sbin/ppp-go
  1197. echo "cat /dev/null >/var/log/messages" >> /usr/sbin/ppp-go
  1198. echo 'echo "Contents of /var/log/messages file removed."' >> /usr/sbin/ppp-go
  1199. echo "else" >> /usr/sbin/ppp-go
  1200. echo 'echo "Cancelled."' >> /usr/sbin/ppp-go
  1201. echo "fi" >> /usr/sbin/ppp-go
  1202. echo 'echo -n "Remove contents of /var/log/debug file? (N/y) : "' >> /usr/sbin/ppp-go
  1203. echo "read ans" >> /usr/sbin/ppp-go
  1204. echo 'if [ "$ans" = "y" -o "$ans" = "Y" ]; then' >> /usr/sbin/ppp-go
  1205. echo "cat /dev/null >/var/log/debug" >> /usr/sbin/ppp-go
  1206. echo 'echo "Contents of /var/log/debug file removed."' >> /usr/sbin/ppp-go
  1207. echo "exit 0" >> /usr/sbin/ppp-go
  1208. echo "else" >> /usr/sbin/ppp-go
  1209. echo 'echo "Cancelled."' >> /usr/sbin/ppp-go
  1210. echo "exit 0" >> /usr/sbin/ppp-go
  1211. echo "fi" >> /usr/sbin/ppp-go
  1212. echo "fi" >> /usr/sbin/ppp-go
  1213.  
  1214. echo >> /usr/sbin/ppp-go
  1215. echo 'echo "USAGE: ppp-go -h <Help>"' >> /usr/sbin/ppp-go
  1216. echo "exit 1" >> /usr/sbin/ppp-go
  1217.  
  1218. #chmod 4755 /usr/sbin/ppp-go 2>/dev/null 
  1219. chmod 755 /usr/sbin/ppp-go 2>/dev/null 
  1220.     
  1221. cat << EOF > /etc/ppp/options
  1222. # General configuration options for PPPD:
  1223. lock
  1224. defaultroute
  1225. noipdefault
  1226. modem
  1227. /dev/$MODEM
  1228. $BAUDRATE
  1229. crtscts
  1230. # Uncomment the line below for more verbose error reporting:
  1231. #debug
  1232. # If you have a default route already, pppd may require the other side
  1233. # to authenticate itself, which most ISPs will not do.  To work around this,
  1234. # uncomment the line below.  Note that this may have negative side effects
  1235. # on system security if you allow PPP dialins.  See the docs in /usr/doc/ppp*
  1236. # for more information.
  1237. #noauth
  1238. passive
  1239. asyncmap 0
  1240. EOF
  1241.  
  1242. if [ ! -z "$CBPN" ]; then
  1243. echo 'callback "'$CBPN'"' >> /etc/ppp/options
  1244. fi
  1245.   
  1246. if  [ "$MSCHAP" = "MS-CHAP-SERVER-2" ] && [ -s $TMP/rspTEMP2 ]; then
  1247. echo 'name "'$MSDOMAIN\\\\$AUTH1'"' >> /etc/ppp/options
  1248. elif [ -s $TMP/rspTEMP2 ]; then
  1249. echo 'name "'$AUTH1'"' >> /etc/ppp/options
  1250. fi
  1251.  
  1252. if [ ! -z $DOMAINNAME ] && [ "$PAP" = "MS-CHAP-80" ]; then        
  1253. echo 'remotename "'$DOMAINNAME'"' >> /etc/ppp/options
  1254. elif [ "$DOMAINNAME" = "unknown.com" ] && [ "$PAP" = "MS-CHAP-80" ]; then        
  1255. echo 'remotename "unknown.com"' >> /etc/ppp/options
  1256. fi
  1257.  
  1258. chown root.root /etc/ppp/options 2>/dev/null
  1259. chmod 600 /etc/ppp/options 2>/dev/null
  1260.  
  1261. if [ "$PAP" = "PAP" ]; then
  1262. echo "# PAP authentication file: /etc/ppp/pap-secrets" > /etc/ppp/pap-secrets
  1263. echo "# This file should have a permission of 600." >> /etc/ppp/pap-secrets
  1264. echo "# ~# chmod 600 /etc/ppp/pap-secrets" >> /etc/ppp/pap-secrets
  1265. echo "# Username      Server      Password      IP addresses" >> /etc/ppp/pap-secrets
  1266. echo '"'$AUTH1'"   *   "'$AUTH2'"' >> /etc/ppp/pap-secrets
  1267.  
  1268. chown root.root /etc/ppp/pap-secrets 2>/dev/null
  1269. chmod 600 /etc/ppp/pap-secrets 2>/dev/null
  1270.         
  1271. elif [ "$PAP" = "CHAP" ]; then
  1272. echo "# CHAP authentication file: /etc/ppp/chap-secrets" > /etc/ppp/chap-secrets
  1273. echo "# This file should have a permission of 600." >> /etc/ppp/chap-secrets
  1274. echo "# ~# chmod 600 /etc/ppp/chap-secrets" >> /etc/ppp/chap-secrets
  1275. echo "# Username      Server      Password      IP addresses" >> /etc/ppp/chap-secrets
  1276. echo '"'$AUTH1'"   *   "'$AUTH2'"' >> /etc/ppp/chap-secrets
  1277. echo '*   "'$AUTH1'"   "'$AUTH2'"' >> /etc/ppp/chap-secrets
  1278.  
  1279. chown root.root /etc/ppp/chap-secrets 2>/dev/null
  1280. chmod 600 /etc/ppp/chap-secrets 2>/dev/null
  1281.  
  1282. elif [ "$PAP" = "MS-CHAP-80" ] && [ "$MSCHAP" = "MS-CHAP-SERVER-2" ]; then
  1283. echo "# MS-CHAP authentication file: /etc/ppp/chap-secrets" > /etc/ppp/chap-secrets
  1284. echo "# This file should have a permission of 600." >> /etc/ppp/chap-secrets
  1285. echo "# ~# chmod 600 /etc/ppp/chap-secrets" >> /etc/ppp/chap-secrets
  1286. echo "# Username      RemoteHost      Password" >> /etc/ppp/chap-secrets
  1287. echo '"'$MSDOMAIN\\\\$AUTH1'"   "'$DOMAINNAME'"   "'$AUTH2'"' >> /etc/ppp/chap-secrets
  1288. echo '"'$DOMAINNAME'"   "'$MSDOMAIN\\\\$AUTH1'"   "'$AUTH2'"' >> /etc/ppp/chap-secrets
  1289.  
  1290. chown root.root /etc/ppp/chap-secrets 2>/dev/null
  1291. chmod 600 /etc/ppp/chap-secrets 2>/dev/null
  1292.  
  1293. elif [ "$PAP" = "MS-CHAP-80" ]; then
  1294. echo "# MS-CHAP authentication file: /etc/ppp/chap-secrets" > /etc/ppp/chap-secrets
  1295. echo "# This file should have a permission of 600." >> /etc/ppp/chap-secrets
  1296. echo "# ~# chmod 600 /etc/ppp/chap-secrets" >> /etc/ppp/chap-secrets
  1297. echo "# Username      RemoteHost      Password" >> /etc/ppp/chap-secrets
  1298. echo '"'$AUTH1'"   "'$DOMAINNAME'"   "'$AUTH2'"' >> /etc/ppp/chap-secrets
  1299. echo '"'$DOMAINNAME'"   "'$AUTH1'"   "'$AUTH2'"' >> /etc/ppp/chap-secrets
  1300.  
  1301. chown root.root /etc/ppp/chap-secrets 2>/dev/null
  1302. chmod 600 /etc/ppp/chap-secrets 2>/dev/null
  1303. fi
  1304.  
  1305. cp /etc/ppp/options /etc/ppp/options.demand
  1306.  
  1307. echo "ipcp-accept-local" >> /etc/ppp/options.demand
  1308. echo "ipcp-accept-remote" >> /etc/ppp/options.demand
  1309. echo "0.0.0.0:10.10.10.10" >> /etc/ppp/options.demand
  1310. echo "demand" >> /etc/ppp/options.demand
  1311.  
  1312. if [ -s $TMP/cb1TEMP$$ ]; then
  1313. echo 'connect "'$PATH2' -v -f /etc/ppp/callback"' >> /etc/ppp/options.demand
  1314. else
  1315. echo 'connect "'$PATH2' -v -f /etc/ppp/pppscript"' >> /etc/ppp/options.demand
  1316. fi
  1317.  
  1318. chown root.root /etc/ppp/options.demand 2>/dev/null
  1319. chmod 600 /etc/ppp/options.demand 2>/dev/null
  1320.  
  1321. if [ -f $HOME/.ppprc ]; then
  1322. mv $HOME/.ppprc $HOME/.ppprc.off
  1323. PPPRC="YES"
  1324. fi
  1325.  
  1326. demand() {
  1327.  cat <<EOF
  1328. PPP-2.3.0 and later has a demand dialing option, you can use it this way,
  1329. the options file for demand dialing will be /etc/ppp/options.demand.
  1330.  
  1331. Start ppp-go -d, pppd will just stay in the background until you try to 
  1332. connect to some site, then pppd will dial your service provider and make 
  1333. the ppp connection.
  1334.  
  1335. ~# ppp-go -d        <-Start pppd this way for demand dialing.)
  1336.  #                  <-It should drop you back to #.)
  1337.            
  1338. ~# ftp ftp.funet.fi               <-Pppd will start dialing.)             
  1339.  # lynx http://www.foo.com        <-Pppd will start dialing etc.)
  1340.  # ppp-off -d       <-To end and restart pppd in demand dialing mode.)
  1341.  # ppp-off                        <-To end the ppp connection.)
  1342.  
  1343. End...
  1344. =========================================================================
  1345. EOF
  1346. }
  1347.  
  1348. other() {
  1349.  cat <<EOF
  1350. These are some other ways to make a PPP connection.
  1351.  
  1352. The best way to make a PPP connection is to create a chat script, if
  1353. you're having trouble with the chat script you can use these methods
  1354. below to make the PPP connection.
  1355.  
  1356. You can also use these methods below to see what's going on when you
  1357. connect to your service provider, i.e. what do they require, do they
  1358. present you with a Login: or Username: and Password: prompt etc.
  1359.  
  1360. What steps do you have to go through before they start PPP at there
  1361. end?
  1362.  
  1363. First make sure the IP address of your service providers nameserver  
  1364. is in the /etc/resolv.conf file.
  1365.  
  1366. nameserver 205.117.312.56   <-For example.)
  1367.  
  1368. =========================================================================
  1369. Using 'dip' to make the PPP connection.
  1370. =========================================================================
  1371.  
  1372. ~# dip -tv
  1373. Host name lookup failure
  1374.  
  1375. If you get the above messgae when you start 'dip', it's because you
  1376. don't have your hostname in the /etc/hosts file.
  1377.  
  1378. ~# hostname
  1379. foobar
  1380.  
  1381. If your hostname were 'foobar' you should put it in the /etc/hosts file.
  1382.  
  1383. 127.0.0.1   localhost
  1384. 0.0.0.0     foobar.localnet foobar
  1385.  
  1386. ~# dip -tv
  1387. dip> port /dev/ttyS1
  1388. can't open - problems with locking ttyS1
  1389.  
  1390. If you get the above message after "port /dev/modem", it means you have a
  1391. lock file in /var/lock/LCK..ttyS1, remove the lock file and kill dip.
  1392.  
  1393. ~# rm /var/lock/LCK*
  1394.  # killall -9 dip
  1395.  
  1396. ~# dip -tv
  1397.  
  1398. dip> port /dev/ttyS1    <-Where's the modem? ttyS0 = com1 ttyS1 = com2 etc.)
  1399. dip> speed 115200      <-Modem speed: 19200 38400 57600
  1400. dip> term
  1401.  
  1402. at&fw2                 <-Modem init string.)
  1403. atdt1234567            <-Replace 1234567 with the phone number.)
  1404.  
  1405. Usally you give your username and password then ppp is started, if
  1406. they use PAP or CHAP you probably won't be asked for a username and
  1407. password, they will just say that PPP has been started or nothing.
  1408.  
  1409. Press Ctrl ] to exit dip term mode when PPP is started at their end.
  1410.  
  1411. dip> default              <-Use default route.)
  1412. dip> mode ppp             <-Start PPP at your end.)
  1413.  
  1414. ~# ping metalab.unc.edu   <-To see if you're connected.)
  1415.  
  1416. ~# dip -k                 <-To kill dip and the PPP connection.)
  1417.  
  1418. =========================================================================
  1419. Using 'minicom' to make the PPP connection.
  1420. =========================================================================
  1421.  
  1422. Keep the /etc/ppp/options file that was created by pppsetup, it should 
  1423. have at least these options in it.
  1424.  
  1425. lock
  1426. defaultroute
  1427. noipdefault
  1428. /dev/ttyS1         <- ttyS0 = com1 ttyS1 = com2 ttyS2 = com3 ttyS3 = com4           
  1429. 57600
  1430. modem
  1431. crtscts
  1432. debug
  1433. asyncmap 0
  1434.  
  1435. ~# minicom -m -s
  1436.  
  1437. at&fw2
  1438. atdt1234567
  1439.  
  1440. Press Alt Q to exit minicom without reset after PPP is started at 
  1441. the other end.
  1442.  
  1443. ~# pppd                <-Start PPP at your end.)
  1444.  
  1445. ~# ppp-off             <-To end the PPP connection.)
  1446.  # killall -INT pppd   <-If you don't have 'ppp-off' end it this way.)
  1447.  
  1448. End...
  1449. =========================================================================
  1450. EOF
  1451. }
  1452.  
  1453. echo "=========================================================================" > /etc/ppp/pppsetup.txt
  1454. cat $TMP/txtTEMP01 >> /etc/ppp/pppsetup.txt
  1455.  
  1456. echo "=========================================================================" > $TMP/txtTEMP$$
  1457. echo "These are your PPP configuration files and instructions..." >> $TMP/txtTEMP$$
  1458. echo "=========================================================================" >> $TMP/txtTEMP$$
  1459. echo >> $TMP/txtTEMP$$
  1460.  
  1461. if [ ! -s $TMP/cb1TEMP$$ ] && [ ! -s $TMP/sayTEMP1 ]; then
  1462. echo "# This is your /etc/ppp/pppscript." >> $TMP/txtTEMP$$
  1463. echo >> $TMP/txtTEMP$$
  1464. cat /etc/ppp/pppscript >> $TMP/txtTEMP$$
  1465. elif [ ! -s $TMP/cb1TEMP$$ ] && [ -s $TMP/sayTEMP1 ]; then
  1466. echo "# This is your /etc/ppp/pppscript." >> $TMP/txtTEMP$$
  1467. echo >> $TMP/txtTEMP$$
  1468. echo "Look at /etc/ppp/pppscript." >> $TMP/txtTEMP$$
  1469. echo >> $TMP/txtTEMP$$
  1470. fi
  1471.  
  1472. if [ -s $TMP/cb1TEMP$$ ]; then
  1473. echo "# This is your /etc/ppp/callback script." >> $TMP/txtTEMP$$
  1474. echo >> $TMP/txtTEMP$$
  1475. echo "Look at /etc/ppp/callback." >> $TMP/txtTEMP$$
  1476. echo >> $TMP/txtTEMP$$
  1477. fi
  1478.  
  1479. echo "# This is your /etc/ppp/options file." >> $TMP/txtTEMP$$
  1480. echo >> $TMP/txtTEMP$$
  1481. cat /etc/ppp/options >> $TMP/txtTEMP$$
  1482.  
  1483. if [ "$MODERROR" = "YES" ]; then
  1484. echo >> $TMP/txtTEMP$$
  1485. echo "WARNING: I could not find the modem device: '/dev/$MODEM'" >> $TMP/txtTEMP$$
  1486. echo "ttyS0 = com1 ttyS1 = com2 ttyS2 = com3  ttyS3 = com4" >> $TMP/txtTEMP$$
  1487. echo "# MAKEDEV $MODEM   # /dev/MAKEDEV $MODEM" >> $TMP/txtTEMP$$
  1488. fi
  1489.  
  1490. if [ "$DOMAINNAME" = "unknown.com" ] && [ "$PAP" = "MS-CHAP-80" ]; then        
  1491. echo >> $TMP/txtTEMP$$
  1492. echo "The remotename option is required for microsoft's ms-chap-80." >> $TMP/txtTEMP$$
  1493. echo "You didn't give a DOMAIN NAME so i put unknown.com, you should" >> $TMP/txtTEMP$$
  1494. echo "change that to your service providers domain name." >> $TMP/txtTEMP$$
  1495. fi
  1496.  
  1497. if [ ! "$MODERROR" = "YES" ]; then
  1498. echo >> $TMP/txtTEMP$$
  1499. echo "I created the symbolic link: /dev/modem -> /dev/$MODEM" >> $TMP/txtTEMP$$
  1500. fi
  1501.  
  1502. echo >> $TMP/txtTEMP$$
  1503. echo "# This is your /etc/ppp/options.demand dialing file." >> $TMP/txtTEMP$$
  1504. echo >> $TMP/txtTEMP$$
  1505. cat /etc/ppp/options.demand >> $TMP/txtTEMP$$
  1506.  
  1507. echo >> $TMP/txtTEMP$$
  1508. echo "If you have a ethernet connection you should change the local:remote" >> $TMP/txtTEMP$$
  1509. echo "IP addresses in the options.demand file, to your actual local and" >> $TMP/txtTEMP$$
  1510. echo "remote address.  Example: 215.346.117.89:312.217.187.96" >> $TMP/txtTEMP$$
  1511.  
  1512. echo >> $TMP/txtTEMP$$
  1513. echo "# This in your /etc/resolv.conf file." >> $TMP/txtTEMP$$
  1514. echo >> $TMP/txtTEMP$$
  1515. cat /etc/resolv.conf >> $TMP/txtTEMP$$
  1516.  
  1517. echo >> $TMP/txtTEMP$$
  1518. if [ -z $DNSIP ]; then
  1519. echo "207.132.116.5   <-IMPORTANT: This should be the IP address of" >> $TMP/txtTEMP$$
  1520. echo "                             your service providers nameserver." >> $TMP/txtTEMP$$
  1521. else
  1522. echo "$DNSIP   <-IMPORTANT: This should be the IP address of" >> $TMP/txtTEMP$$
  1523. echo "                    your service providers nameserver." >> $TMP/txtTEMP$$
  1524. fi
  1525.  
  1526. if [ -z $DNSIP ]; then
  1527. echo >> $TMP/txtTEMP$$
  1528. echo "WARNING: You didn't give a IP address for your internet service" >> $TMP/txtTEMP$$
  1529. echo "providers nameserver, i put '207.132.116.5' but this may not work." >> $TMP/txtTEMP$$
  1530. fi
  1531.  
  1532. if [ "$PAP" = "CHAP" ] || [ "$PAP" = "MS-CHAP-80" ]; then
  1533. echo >> $TMP/txtTEMP$$
  1534. echo "# This is your /etc/ppp/chap-secrets file." >> $TMP/txtTEMP$$
  1535. echo >> $TMP/txtTEMP$$
  1536. echo "Look at /etc/ppp/chap-secrets." >> $TMP/txtTEMP$$
  1537. fi
  1538.  
  1539. if [ "$DOMAINNAME" = "unknown.com" ] && [ "$PAP" = "MS-CHAP-80" ]; then
  1540. echo >> $TMP/txtTEMP$$
  1541. echo "You didn't give a DOMAIN NAME that's why i put unknown.com in" >> $TMP/txtTEMP$$
  1542. echo "the /etc/ppp/chap-secrets file." >> $TMP/txtTEMP$$
  1543. echo "You should change that to your service providers domain name." >> $TMP/txtTEMP$$
  1544. fi
  1545.  
  1546. if [ "$PAP" = "PAP" ]; then
  1547. echo >> $TMP/txtTEMP$$
  1548. echo "# This is your /etc/ppp/pap-secrets file." >> $TMP/txtTEMP$$
  1549. echo >> $TMP/txtTEMP$$
  1550. echo "Look at /etc/ppp/pap-secrets." >> $TMP/txtTEMP$$
  1551. fi
  1552.  
  1553. if [ "$PATH1" = "pppd" ]; then
  1554. echo >> $TMP/txtTEMP$$
  1555. echo "ATENTION: I couldn't find <pppd> on your system." >> $TMP/txtTEMP$$
  1556. echo "You need <pppd> on your system to make the PPP connection." >> $TMP/txtTEMP$$
  1557. fi
  1558.  
  1559. if [ "$PATH2" = "chat" ]; then
  1560. echo >> $TMP/txtTEMP$$
  1561. echo "ATENTION: I couldn't find <chat> on your system." >> $TMP/txtTEMP$$
  1562. echo "You need <chat> on your system to make the PPP connection." >> $TMP/txtTEMP$$
  1563. fi
  1564.  
  1565. if [ ! "$MSG1" = "YES" ] && [ ! "$MSG2" = "YES" ]; then
  1566. echo >> $TMP/txtTEMP$$
  1567. echo "ATENTION: I couldn't find 'PPP' in the kernel or as a module." >> $TMP/txtTEMP$$
  1568. echo "You'll need 'PPP' in the kernel or as a module to make a PPP connection." >> $TMP/txtTEMP$$
  1569. fi
  1570.  
  1571. if [ "$PPPRC" = "YES" ]; then
  1572. echo >> $TMP/txtTEMP$$
  1573. echo "ATENTION: I found a $HOME/.ppprc file and moved it to" >> $TMP/txtTEMP$$
  1574. echo ".ppprc.off, it might interfere with the PPP connection." >> $TMP/txtTEMP$$
  1575. fi
  1576.  
  1577. echo >> $TMP/txtTEMP$$
  1578. echo "Does everything look correct? if not, run 'pppsetup' again..." >> $TMP/txtTEMP$$
  1579.  
  1580. echo >> $TMP/txtTEMP$$
  1581. echo "=========================================================================" >> $TMP/txtTEMP$$
  1582. echo "To connect to your service provider." >> $TMP/txtTEMP$$
  1583. echo "=========================================================================" >> $TMP/txtTEMP$$
  1584. echo >> $TMP/txtTEMP$$
  1585. echo "~# ppp-go      <-Make PPP connection.)" >> $TMP/txtTEMP$$
  1586.  
  1587. echo >> $TMP/txtTEMP$$
  1588. echo "You'll hear and see the modem dialing then once connected," >> $TMP/txtTEMP$$
  1589. echo "logging you in Username: or Login: and Password: etc." >> $TMP/txtTEMP$$
  1590.  
  1591. echo >> $TMP/txtTEMP$$
  1592. echo "You won't see a Username or Login: and Password: prompt" >> $TMP/txtTEMP$$
  1593. echo "if they're using PAP or CHAP to authenticate you." >> $TMP/txtTEMP$$
  1594.  
  1595. echo >> $TMP/txtTEMP$$
  1596. echo "If they use PAP or CHAP you'll just see CONNECT -- got it." >> $TMP/txtTEMP$$
  1597.  
  1598. echo >> $TMP/txtTEMP$$
  1599. echo "If the connection was successful you'll see the Local IP and" >> $TMP/txtTEMP$$
  1600. echo "Remote IP address printed to the screen, you can press [Enter]." >> $TMP/txtTEMP$$
  1601.  
  1602. echo >> $TMP/txtTEMP$$
  1603. echo "If you run ppp-go in X windows you probably won't see a Local" >> $TMP/txtTEMP$$
  1604. echo "and Remote IP address printed to the screen, you'll just see" >> $TMP/txtTEMP$$
  1605. echo "the connection process come to a end, wait a few seconds and" >> $TMP/txtTEMP$$
  1606. echo "press [Enter] at that point." >> $TMP/txtTEMP$$
  1607.  
  1608. echo >> $TMP/txtTEMP$$
  1609. echo "If you don't connect for whatever reason e.g. Failed No" >> $TMP/txtTEMP$$ 
  1610. echo "Dialtone, Busy, No Carrier, Whatever, Exit, just press" >> $TMP/txtTEMP$$ 
  1611. echo "[Enter] at that point." >> $TMP/txtTEMP$$
  1612.  
  1613. echo >> $TMP/txtTEMP$$
  1614. echo "if you have syslogd running, you can see the output messages" >> $TMP/txtTEMP$$ 
  1615. echo "from pppd and chat in the /var/log/messages and or debug file." >> $TMP/txtTEMP$$ 
  1616.  
  1617. echo >> $TMP/txtTEMP$$
  1618. echo "Sample /var/log/messages file." >> $TMP/txtTEMP$$    
  1619. echo >> $TMP/txtTEMP$$
  1620. echo "`hostname 2>/dev/null` pppd[562]: Serial connection established." >> $TMP/txtTEMP$$    
  1621. echo "`hostname 2>/dev/null` pppd[562]: Using interface ppp0" >> $TMP/txtTEMP$$              
  1622. echo "`hostname 2>/dev/null` pppd[562]: Connect: ppp0 <--> /dev/modem" >> $TMP/txtTEMP$$     
  1623. echo "`hostname 2>/dev/null` pppd[562]: local IP address 215.87.78.18" >> $TMP/txtTEMP$$      
  1624. echo "`hostname 2>/dev/null` pppd[562]: remote IP address 205.94.97.35" >> $TMP/txtTEMP$$     
  1625.  
  1626. echo >> $TMP/txtTEMP$$
  1627. echo "You don't have a successful PPP connection until you" >> $TMP/txtTEMP$$ 
  1628. echo "receive a local & remote IP address like above." >> $TMP/txtTEMP$$
  1629.  
  1630. echo >> $TMP/txtTEMP$$
  1631. echo "If you have the X window system, you could connect in a Xterm." >> $TMP/txtTEMP$$
  1632. echo >> $TMP/txtTEMP$$
  1633. echo "`hostname 2>/dev/null` # startx" >> $TMP/txtTEMP$$
  1634. echo "`hostname 2>/dev/null` # ppp-go" >> $TMP/txtTEMP$$
  1635. echo "`hostname 2>/dev/null` # netscape mosaic etc." >> $TMP/txtTEMP$$
  1636.  
  1637. echo >> $TMP/txtTEMP$$
  1638. echo "~# ppp-off     <-To end the ppp connection.)" >> $TMP/txtTEMP$$
  1639.  
  1640. echo >> $TMP/txtTEMP$$
  1641. echo "~# ppp-go -h   <-For help.)" >> $TMP/txtTEMP$$
  1642.  
  1643. echo >> $TMP/txtTEMP$$
  1644. echo 'There is no support in linux for "WinModems", if you have a' >> $TMP/txtTEMP$$
  1645. echo "WinModem you will not be able to use it in linux." >> $TMP/txtTEMP$$ 
  1646. echo >> $TMP/txtTEMP$$
  1647. echo "There is support for plug n play modems, if you have a pnp" >> $TMP/txtTEMP$$
  1648. echo 'modem you may need "isapnptools" to get it recognized.' >> $TMP/txtTEMP$$
  1649.  
  1650. echo >> $TMP/txtTEMP$$
  1651. echo "=========================================================================" >> $TMP/txtTEMP$$
  1652. if [ -s /usr/doc/pppsetup/pppsetup-$VERSION.README ]; then
  1653. echo "#### Look at the /usr/doc/pppsetup/pppsetup-$VERSION.README. ####" >> $TMP/txtTEMP$$
  1654. fi
  1655. echo "#### A copy of this text can be found in: /etc/ppp/pppsetup.txt ####" >> $TMP/txtTEMP$$
  1656. echo "=========================================================================" >> $TMP/txtTEMP$$
  1657.  
  1658. echo >> $TMP/txtTEMP$$
  1659. echo "Done... You can exit now..." >> $TMP/txtTEMP$$
  1660. echo >> $TMP/txtTEMP$$
  1661. echo "End..." >> $TMP/txtTEMP$$
  1662. echo "=========================================================================" >> $TMP/txtTEMP$$
  1663.  
  1664. dialog --title "DONE" --clear --textbox "$TMP/txtTEMP$$" 22 78    
  1665.             
  1666. clear 2>/dev/null || echo
  1667.  
  1668. cat $TMP/txtTEMP$$ >> /etc/ppp/pppsetup.txt
  1669. chmod 600 /etc/ppp/pppsetup.txt 2>/dev/null 
  1670.  
  1671. if [ ! -s /etc/syslog.conf ]; then
  1672. echo "# Log info & debug messages to these files." > /etc/syslog.conf
  1673. echo >> /etc/syslog.conf
  1674. echo "*.=debug                        /var/log/debug" >> /etc/syslog.conf
  1675. echo "*.=info;*.=notice                /var/log/messages" >> /etc/syslog.conf
  1676.  
  1677. demand >> /etc/ppp/pppsetup.txt
  1678. other >> /etc/ppp/pppsetup.txt
  1679. rm -f $TMP/*TEMP* 2>/dev/null
  1680.  
  1681. killall -9 syslogd 2>/dev/null 
  1682. syslogd & 2>/dev/null 
  1683. echo
  1684. echo "#### A copy of this text can be found in: /etc/ppp/pppsetup.txt ####" 
  1685. if [ -s /usr/doc/pppsetup/pppsetup-$VERSION.README ]; then
  1686. echo "#### Look at the /usr/doc/pppsetup/pppsetup-$VERSION.README. ####" 
  1687. fi
  1688. echo
  1689. exit 
  1690.  
  1691. else
  1692. demand >> /etc/ppp/pppsetup.txt
  1693. other >> /etc/ppp/pppsetup.txt
  1694. rm -f $TMP/*TEMP* 2>/dev/null
  1695. echo
  1696. echo "#### A copy of this text can be found in: /etc/ppp/pppsetup.txt ####" 
  1697. if [ -s /usr/doc/pppsetup/pppsetup-$VERSION.README ]; then
  1698. echo "#### Look at the /usr/doc/pppsetup/pppsetup-$VERSION.README. ####" 
  1699. fi
  1700. echo
  1701. exit 
  1702. fi
  1703.  
  1704.